def commands():
    """Returns the list of commands that this plugin handles.
    """
    return ['r']
    
def process(command, arguments):
    """Processes the given command and arguments, returns None if nothing
    is to be displayed else, returns the text that should be displayed as
    a note.
    """
    if command == "r":
        import calendar
        import time
        
        arguments = arguments.split(" ")
        option = arguments[0]
        
        if len(option.split(":")) == 2:
            # we have time in format 13:45
            
            #TODO check today's time, if the current time is past the given time
            # then we need to set alarm for tomorrow, else today.
            
            alarm_time = None

        elif option.find("t"):
            #TODO check if alarm time is given, if yes use that and
            # date = tomorrow, else set time to 9 am tomorrow
            # The "find" function should let us be flexible with
            # 16:00t / 16:00tom / 16:00tomorrow
            
            alarm_time = None

        elif option[-1] == "h":
            # we have time in hours from now
            alarm_time = time.time() + (int(option) * 60 * 60)
            
        else:
            # assume the time is in minutes after now
            alarm_time = time.time() + (int(option) * 60)
            
        c = calendar.open()
        a = c.add_appointment()
        a.set_time(alarm_time + 1)
        a.alarm = alarm_time
        a.content = ' '.join(arguments[1:])
        a.commit()
        
